package juc.future;

import java.util.concurrent.*;

/**
 * @author fangbin
 * @desc
 * @date 2020/6/30 7:37
 */
public class OneFuture {

    public static void main(String[] args) throws ExecutionException, InterruptedException {

        ExecutorService executorService = Executors.newFixedThreadPool(5);
        Future<Integer> submit = executorService.submit(new MyRunnable());
        System.out.println(submit.get());
    }

}

class MyRunnable implements Callable {

    @Override
    public Integer call() throws Exception {
        Thread.sleep(1);
        return new Integer((int) (Math.random()*1000));
    }
}
